﻿using UnityEngine;
using System.Collections;
using ProtoBuf.Message;

namespace Room
{
    public class RCAIUnionActorTransfer : RCAIUnionActorBase
    {
        bool isMine = false;
        protected override void OnEnter()
        {
            controller.Spawn(RoomUnionFight.TRANSFER_EFFECT_BEGIN, 5f);
            
            var _uuid = controller.owner.name;
            var uuid = 0L;
            isMine = false;
            if (long.TryParse(_uuid, out uuid))
            {
                if (uuid == StaticData.playerData.playerId)
                {
                    isMine = true;
                }
            }
            
            if(isMine)
            {
                EasyTouchTool.Instance.Hide();
            }
        }
        
        protected override void OnTick()
        {

        }

        protected override void OnLeave()
        {
            if (isMine)
            {
                EasyTouchTool.Instance.ShowJoystick();
            }

            controller.Spawn(RoomUnionFight.TRANSFER_EFFECT_END,2f);
        }
    }
}